<template>
  <div class="h-full px-20">
    <GiTable
      row-key="cloudCrossOrderEnableTime"
      v-model:columns="columns"
      :loading="loading"
      :data="tableData"
      :pagination="false"
      @refresh="getTableData"
      :hide="true"
      :scroll="{ x: '100%', y: 400 }"
    >
    </GiTable>
  </div>
</template>

<script setup>
import { cloudCrossOrderEnableList } from '@/apis'

const loading = ref(false)
const tableData = ref([])
const columns = ref([
  {
    title: '开始时间',
    dataIndex: 'startTime',
    width: 180
  },
  {
    title: '结束时间',
    dataIndex: 'endTime',
    width: 180,
    render: ({ record }) => {
      return record.endTime || '--'
    }
  }
])

// 获取列表数据
const getTableData = async () => {
  try {
    const res = await cloudCrossOrderEnableList()
    tableData.value = res.data
    console.log(tableData.value)
  } finally {
    loading.value = false
  }
}

onMounted(() => {
  getTableData()
})
</script>
